import React, { Component } from 'react';
// 引入路由
import { Switch, Route, NavLink } from 'react-router-dom';
// 引入子组件
import Page1 from './Page1';
import Page2 from './Page2';
import Page3 from './Page3';

class Layout extends Component {
  render() {
    return (
      <div>
        <div>我是固定的组件-嵌套路由</div>
        <NavLink to="/layout/page1">page1</NavLink>
        <NavLink to="/layout/page2">page2</NavLink>
        <NavLink to="/layout/page3">page3</NavLink>
        <hr />
        <Switch>
          <Route path="/layout/page1" component={Page1}></Route>
          <Route path="/layout/page2" component={Page2}></Route>
          <Route path="/layout/page3" component={Page3}></Route>
        </Switch>
      </div>
    );
  }
}

export default Layout;
